package com.yshye.simplefactory;

public class Factory {

	public static Api createApi(int type) {
		Api api = null;
		if (type == 1) {
			api = new A();
		} else if (type == 2) {
			api = new B();
		}
		return api;
	}
	public static Api getApi(String className) throws Exception{
		Api api = null;
		api = (Api)Class.forName(className).newInstance();
		return api;
	}	
}
